package com.it.reggie.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.it.reggie.dao.CategoryDao;
import com.it.reggie.entity.Category;
import com.it.reggie.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author:cyh
 * @data:2022/12/15 9:54
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> implements ICategoryService {
    @Autowired
    CategoryDao categoryDao;

    @Override
    public boolean deleteById(Long id) {
        int count1=categoryDao.queryDishById(id);
        if (count1>0){
            return false;
        }
        int count2=categoryDao.querySetmealById(id);
        if (count2>0){
            return false;
        }
        int delete = categoryDao.deleteById(id);
        return delete > 0;
    }


}
